package reflect;


import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class exists01 {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("reflect.person");
        Constructor c = cls.getConstructor(String.class);
        Object obj = c.newInstance("张三");

        Method[] methods = cls.getDeclaredMethods();
        for (Method method : methods){
            if (method.isAnnotationPresent(AutoRunMethod.class)){
                AutoRunMethod arm = method.getAnnotation(AutoRunMethod.class);
                int mouth = arm.value();
                for (int i=0;i<mouth;i++){
                    System.out.println("调用方法"+method.getName()+"()"+mouth+"次");
                    method.invoke(obj);
                }
            }else {
                System.out.println(method.getName()+"()没有被注释");
            }
        }


















    }















}
